package com.sparrow;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.statemachine.StateMachine;

import com.sparrow.statemachine.Events;
import com.sparrow.statemachine.States;

//@EnableCaching  缓存注解
//@SpringBootApplication
//@EnableScheduling  定时注解
//@EnableAsync		异步注解 
//public class SparrowApplication {
//
//	public static void main(String[] args) {
////		SpringApplication.setAddCommandLineProperties(false);
//		SpringApplication.run(SparrowApplication.class, args);
//	}
//}


/**
 * 
 *@Description: 状态机测试启动
 *@Author:hjt 
 *@Version:1.0.0
 */
@SpringBootApplication
public class SparrowApplication implements CommandLineRunner{

	public static void main(String[] args) {
//		SpringApplication.setAddCommandLineProperties(false);
		SpringApplication.run(SparrowApplication.class, args);
	}
	
	@Autowired
	private StateMachine<States, Events> stateMachine;

	@Override
	public void run(String... args) throws Exception {
		stateMachine.start();
		stateMachine.sendEvent(Events.PAY);
		stateMachine.sendEvent(Events.RECEIVE);
	}
}

